﻿using Microsoft.Xna.Framework;


namespace LoD.WPClientLibrary.Animations {
    public class CycleColor : Animation {
        public CycleColor(int red, int green, int blue, int alpha) {
            this.Red = red;
            this.Green = green;
            this.Blue = blue;
            this.Alpha = alpha;
            Animating = true;
        }

        public int Alpha { get; set; }
        public int Blue { get; set; }
        public int Green { get; set; }
        public int Red { get; set; }

        public override Color ModifyColor(Color original) {
            Color modified = original;

            if (Animating) {
                int r = original.R + this.Red;
                int g = original.G + this.Green;
                int b = original.B + this.Blue;
                int a = original.A + this.Alpha;

                if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255 || a < 0 || a > 255) Animating = false;
                modified = new Color(r, g, b, a);
            }
            return modified;
        }
    }
}